/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 15085202591
 * Date: 2022-11-24
 * Time: 9:57
 */

class Weapon{
    public void use(){
    }
}
class Sword extends Weapon{
    public void use(){
        System.out.println("Sword");
    }
}
class Knife extends Weapon{
    public void use(){
        System.out.println("Knife");
    }
}
class Role{
    public Role(){

    }
    public Weapon weapon;

    public Weapon getWeapon(Weapon weapon) {
        return weapon;
    }
    public void setWeapon(Weapon weapon) {
        this.weapon = weapon;
    }
    public void use(){
        weapon.use();
    }
}
public class Main7 {
    public static void main(String[] args){
        Role r=new Role();
        r.setWeapon(new Knife());
        r.use();
        r.setWeapon(new Sword());
        r.use();
    }
}
